PrestaShop Google Tag Manager

PrestaShop Google Tag Manager documentation
Comprehensive documentation for the PrestaShop module for advanced integration with Google Tag Manager (cc_ps_googletrack) with support for Enhanced Ecommerce, Enhanced Conversions, and full event configuration.

Table of contents
  1. Introduction
  2. Installation and system requirements
  3. Module activation
  4. Basic GTM configuration
  5. Event configuration
  6. Extended data layer
  7. Enhanced Conversions (user data)
  8. Debug mode
  9. Event registration
  10. Your own tracking code
  11. Translation system
  12. Events – details
  13. Events calendar
  14. Tag Assistant Test
  15. Troubleshooting
  16. FAQ

1. introduction
CC Google Tag Manager is an advanced PrestaShop module that provides full integration with Google Tag Manager. The module automatically tracks all key Enhanced Ecommerce events in accordance with the latest standards.

Key features of the module:
  • Full integration with Google Tag Manager (GTM)
  • Automatic tracking of 18 different events
  • Enhanced Ecommerce in accordance with Google standards
  • Enhanced Conversions with hashed user data
  • Extended data layer (dataLayer) with additional information
  • Configuration of enabling/disabling individual events
  • Debug mode with browser console login
  • Logging events to a database with viewing
  • Your own JavaScript code executed on all pages
  • Full translation system (Polish, English, possibility to add other languages)
  • Compatible with PrestaShop 1.7.x, 8.x, and 9.x
  • Support for Google Consent Mode 2.0

2. installation and system requirements
System requirements
  • PrestaShop 1.7.0.0 or newer (tested up to version 9.0)
  • PHP 7.4 or later
  • Access to the PrestaShop admin panel
  • Google Tag Manager account (free)
  • Optional: Google Analytics 4 (free)
Installation process
  1. Download the ZIP file of the module from the official website. cocos.codes
  2. Log in to your PrestaShop admin panel
  3. Go to: Modules → Module Manager
  4. Click „Upload module” in the upper right corner.
  5. Select the downloaded ZIP file and click „Upload this module.”
  6. When the installation is complete, click "Configure"
  7. The module is ready for configuration.
Info
After installation, the module automatically registers all necessary PrestaShop hooks and creates a table in the database for logging events (if the function is enabled). The installation does not require any additional technical steps.

3. Module activation
The module does not require separate license activation—it works immediately after installation. However, to start tracking, we need to configure the basic settings.

First steps after installation:
  1. Go to Modules → Module Manager
  2. Find the „Google Tag Manager CC” module”
  3. Click „Configure.”
  4. We will be redirected to the module settings page.
Tip
Before starting the configuration, it is worth preparing the GTM container ID (format: GTM-XXXXXX). We can find it in the Google Tag Manager panel after creating a new container for our website.

4. Basic GTM configuration
Configuring Google Tag Manager is the first step to setting up tracking in your store.

Creating a GTM container:
  1. Go to tagmanager.google.com
  2. Sign in with your Google account
  3. Click „Create Account”
  4. Enter the account name (e.g., company name)
  5. Enter the name of the container (e.g., store name)
  6. Select „Web” as the container type
  7. Accept the terms of service
  8. Copy the container ID (GTM-XXXXXX)
Configuration in the module:
  1. In the module configuration, find the „Basic configuration” section.”
  2. Check the „Enable Google Tag Manager” checkbox.”
  3. Paste the copied GTM Container ID (e.g., GTM-ABC1234)
  4. Click „Save” at the bottom of the page.
Basic configuration elements:
OptionDescriptionValue
Enable GTMActivates tracking by GTMYES / NO
GTM Container IDGTM container IDGTM-XXXXXX
What happens after saving:
  • The GTM code (gtag.js) is automatically added to all pages of the store.
  • The GTM script is placed in the section.
  • Noscript fallback is added immediately after <body>
  • DataLayer begins collecting event data
  • All events are automatically sent to GTM.
Success
Once correctly configured, the GTM code will be visible in the page source. We can check this by right-clicking → „View page source” and searching for GTM-XXXXXX. There we will find both the main script and the dataLayer.

5. Event configuration
The module supports 18 different events. Each event can be enabled or disabled independently according to business needs.

List of available events:
EventDescriptionWhen is it called?
page_viewPage displayOn every page of the store
view_itemProduct displayOn the product page
view_item_listView a list of productsCategories, search results, home page
select_itemClicking on a productClicking on a product from the list
add_to_cartAdd to cartAfter adding the product to the cart
remove_from_cartRemove from cartAfter removing the product from the cart
view_cartView cartOn the shopping cart page
begin_checkoutStart of orderFirst step in order fulfillment
add_shipping_infoAdding delivery informationChoosing a delivery method
add_payment_infoAdding payment informationChoosing a payment method
purchasePurchaseOrder confirmation page
searchSearchUsing the store search engine
select_promotionClicking on a promotionClicking on a promotional banner
loginLoginCustomer login
sign_upRegistrationNew customer registration
add_to_wishlistAdd to wish listAdd product to wishlist
shareSharingClicking on the social share button
Enabling/disabling events:
  1. In the module configuration, go to the „Event configuration” section.”
  2. Find a list of all 18 events
  3. Check the boxes next to the events you want to track.
  4. Uncheck the checkboxes next to the events you want to disable.
  5. Use the „Select All” or „Deselect All” buttons for quick configuration.
  6. Click „Save.”
Passing configuration to JavaScript:
// Konfiguracja eventów przekazywana do JS jako: window.ccpsEventConfig = { 'page_view': true, 'view_item': true, 'add_to_cart': true, 'purchase': false, // ... itd. };

// Sprawdzanie czy event jest włączony: function isEventEnabled(eventName) { if (typeof config.eventConfig[eventName] !== 'undefined') { return config.eventConfig[eventName]; } return true; // Domyślnie włączone }
Note
Disabled events are not sent to the dataLayer at all, which saves resources and does not clutter up data in Google Analytics. If an event is disabled, the message „Event disabled: event_name” will appear in debug mode instead of sending data.

6. Extended data layer
The Enhanced Data feature adds additional information to each event, enriching analyses in Google Analytics.

What does the extended data layer contain?
  • Website data – page type, URL, title, language, currency
  • User data – customer status (visitor/guest/customer), user ID
  • Product data – complete categories (up to 5 levels), brands, attributes
  • Order details – delivery methods, payment methods, coupons
Extended data layer configuration:
  1. In the module configuration, find the „Advanced data options” section.”
  2. Check the „Extended data layer” checkbox.”
  3. Check the „Website details” checkbox to add information about the website.
  4. Save your settings
Example of an extended data layer:
dataLayer.push({ 'event': 'page_view', 'page_type': 'product', 'page_url': 'https://example.com/produkt', 'page_title': 'Product name - Store', 'language': 'en', 'currency': 'USD', 'customer_status': 'customer', 'user_id': 123 });
Types of pages recognized by the module:
Page typepage_type valueWhen
HomepagehomeIndexController
Product pageproductProductController
CategorycategoryCategoryController
BasketcartCartController
Order fulfillmentcheckoutOrder Controller
Purchase confirmationpurchaseOrderConfirmationController
SearchsearchSearchController
Content pagecontentCMS Controller
OtherotherAll others
Product categories – hierarchy:
  • item_category – main category (with normalization – first letter capitalized)
  • item_category2 – subcategory level 2
  • item_category3 – subcategory level 3
  • item_category4 – subcategory level 4
  • item_category5 – subcategory level 5
Tip
The enhanced data layer is particularly useful when creating advanced segments in Google Analytics. For example, we can analyze conversions separately for different types of pages, languages, or customer statuses. Enabling this feature is highly recommended.

7. Enhanced Conversions (user data)
Enhanced Conversions is a Google Ads feature that improves conversion measurement accuracy by sending hashed user data.

What are Enhanced Conversions:
  • Hash-encrypted (SHA-256) personal data of users
  • Email, phone number, first name, last name, city, postal code, country
  • Sent to Google in a secure format
  • They enable better attribution of conversions to advertising campaigns.
  • Require user consent (GDPR)
Enhanced Conversions configuration:
  1. In the module configuration, find the „Advanced data options” section.”
  2. Check the „User Data (Enhanced Conversions)” checkbox.”
  3. Ensure that you have the users' consent to process their data (GDPR).
  4. Save your settings
Warning
Transferring user data requires GDPR consent! Let's make sure that our store has an up-to-date privacy and cookie policy and that users give their informed consent to data processing. We recommend integrating with a cookie consent management module such as CC PrestaShop Cookies.
What data is hashed and transmitted:
DataSourceFormat
Email$customer->emailhash(’sha256', strtolower(trim($email)))
PhoneCustomer's first addresshash(’sha256', digits only)
NameCustomer's first addresshash(’sha256', strtolower(trim()))
NameCustomer's first addresshash(’sha256', strtolower(trim()))
CityCustomer's first addresshash(’sha256', strtolower(trim()))
Zip codeCustomer's first addresshash(’sha256', trim())
CountryCustomer's first addressCountry code (without hashing)
Example of data in dataLayer:
dataLayer.push({ 'event': 'purchase', 'user_id': 123, 'customer_status': 'customer', 'user_data': { 'email_hash': 'b4c9a289323b21a01c3e807...', 'phone_hash': '8d23cf6c86e834a7aa6edd9...', 'address': { 'first_name': 'a5bfc9e07964f8dddeb95fc...', 'last_name': '5e884898da28047151d0e56...', 'city': '1c383cd30b7c298ab50293a...', 'postal_code': '4e07408562bedb8b60ce05c...', 'country': 'PL' } } });
Customer statuses:
  • visitor – unregistered user without an account
  • guest – logged in as a guest (guest checkout)
  • customer – logged-in user with a full account
Info
All personal data is hashed using the SHA-256 algorithm before being sent to Google, which means that Google does not receive the data in a readable form. The hash is one-way—the original data cannot be reconstructed from the hash. This meets the GDPR requirements for data minimization.

8. Debug mode
Debug mode allows you to track all events in detail in the browser console, which is invaluable when testing and troubleshooting.

Enabling debug mode:
  1. In the module configuration, find the „Advanced data options” section.”
  2. Check the „Debug mode” checkbox.”
  3. Save your settings
  4. Open the store in a new browser tab
  5. Open the developer console (F12 → Console tab)
  6. Refresh page
What does debug mode display?
  • Module initialization: [CC Google Track] CcpsGoogleTrack v2.0 – initialization
  • Each event sent: [CC Google Track] Event: add_to_cart
  • Event details (e-commerce object)
  • Disabled events: [CC Google Track] Event disabled: share
  • AJAX operations (retrieving product data, wish lists, etc.)
  • Parsing and event handling errors
  • PrestaShop events (updatedCart, updatedProduct)
  • Initialization complete
Example of logs in the console:
[CC Google Track] CcpsGoogleTrack v2.0 - initialization [CC Google Track] Event: page_view {page_type: "product", ...} [CC Google Track] Handler registered: add_to_cart [CC Google Track] Handler registered: remove_from_cart [CC Google Track] Handler registered: select_item [CC Google Track] PrestaShop event: updatedCart {reason: {...}} [CC Google Track] Event: add_to_cart {currency: "USD", value: 99.99, items: [...]} [CC Google Track] CcpsGoogleTrack v2.0 - initialization complete
Various debug messages:
AnnouncementMeaning
Event disabled: event_nameThe event is disabled in the configuration.
Retrieving product data via AJAX for XThe module retrieves product data from the server.
Product data received from PHP for XProduct data has been successfully downloaded.
AJAX error XAn error occurred while retrieving data
JSON parsing errorThe AJAX response is not valid JSON
Handler registered: nameEvent support has been initiated
Tip
Debug mode should ONLY be enabled during testing. In a production environment, it should be disabled so as not to clutter the visitor console and slow down the website. We recommend enabling debug mode on a test/staging environment before deploying to production.

9. Event logging
The event logging feature saves all events to the PrestaShop database, allowing them to be viewed and analyzed later.

Enabling event logging:
  1. In the module configuration, find the „Advanced data options” section.”
  2. Check the „Log events” checkbox.”
  3. Save your settings
  4. The module will automatically create a table. ps_ccpsgoogletrack_logs in the database
Log table structure:
ColumnTypeDescription
log_idINT AUTO_INCREMENTMaster key
event_nameVARCHAR(100)Event name (e.g., add_to_cart)
data_layerTEXTFull dataLayer in JSON format
date_addDATETIMEDate and time added
Viewing logs:
  1. In the module configuration, go to the „Logs” tab.”
  2. You will see a table with the last 100 logs.
  3. Columns: Date, Event, Data Layer (JSON)
  4. The ability to clear all logs with the „Clear logs” button”
Sample log entry:
Event: add_to_cart Date: 2025-12-10 14:30:45 Data Layer: { "event": "add_to_cart", "ecommerce": { "currency": "PLN", "value": 99.99, "items": [ { "item_id": "123", "item_name": "Test product", "price": 99.99, "quantity": 1 } ] }, "page_type": "product", "customer_status": "visitor" }
When events are logged:
  • Events from the administration panel (hook displayHeader) – PHP login
  • Events sent by JavaScript – logging in via AJAX
  • All events except those excluded in the configuration
  • Login works independently of debug mode
Cleaning logs:
  1. In the „Logs” tab, click the „Clear logs” button.”
  2. Confirm the operation in the dialog box.
  3. All logs will be deleted from the database.
  4. A confirmation message will appear.
Warning
Logging events can generate a large amount of data in the database, especially in stores with high traffic. We recommend cleaning logs regularly (e.g., monthly) or enabling logging only during testing. In a production environment, there is usually no need for permanent logging.

10. Your own tracking code
The custom code feature allows you to add custom JavaScript that will be executed on all pages of your store.

Using your own code:
  • Additional GTM events not supported by the module
  • Custom tracking of user interactions
  • Integration with other analytical tools
  • Modify the dataLayer according to your needs
  • Remarketing scripts Facebook Pixel, TikTok Pixel, etc.
Configuring your own code:
  1. In the module configuration, find the „Custom tracking code” section.”
  2. Check the „Enable custom code” checkbox.”
  3. Enter your JavaScript code in the large text field.
  4. Do not use tags – are added automatically
  5. Save your settings
Sample custom code:
// Custom event for dataLayer dataLayer.push({ 'event': 'custom_scroll', 'scroll_depth': '50%' });

// Tracking clicks on specific elements document.querySelectorAll('.special-button').forEach(function(btn) { btn.addEventListener('click', function() { dataLayer.push({ 'event': 'special_button_click', 'button_text': this.textContent }); }); }); // Facebook Pixel !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window, document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', 'YOUR_PIXEL_ID'); fbq('track', 'PageView');
Variables available in your own code:
  • window.dataLayer – main GTM dataLayer
  • window.ccpsGTMDebug – whether debug mode is enabled
  • window.ccpsEventConfig – event configuration
  • window.ccpsUserLogged – whether the user is logged in
  • window.ccpsAjaxUrl – URL to the AJAX controller of the module
  • window.ccpsTranslations – translation board
  • prestashop – PrestaShop object (if available)
Example of using module variables:
// Check if the user is logged in if (window.ccpsUserLogged) { dataLayer.push({ 'event': 'logged_user_pageview' }); } // Use event configuration if (window.ccpsEventConfig && window.ccpsEventConfig['custom_event']) {
// Send only if the event is enabled dataLayer.push({ 'event': 'custom_event' }); } // Debug log if debug mode is enabled if (window.ccpsGTMDebug) { console.log('[My code] Initialization complete'); }
Note
Your own code is added at the end of the HEAD section, after the GTM code and after all module scripts. This means that all module variables and functions are already available. The code is executed on every page of the store, so be careful with performance.

11. Translation system
The module has a complete translation system supporting multiple languages.

Translated elements:
ElementExample ENExample EN
Event namesAdd to cart (add_to_cart)Add to cart (add_to_cart)
Debug messagesEvent disabled:Event disabled:
Error messagesProduct data retrieval errorError fetching product data
StatusesActiveActive
ButtonsSaveSave
Mechanism for transferring translations to JavaScript:
// W PHP (ccpsgoogletrack.php): $translations = [ 'eventDisabled' => $this->l('Event wyłączony:'), 'event' => $this->l('Event:'), 'sendingEvent' => $this->l('Wysyłanie'), // ... itd. ]; $output .= '<script>window.ccpsTranslations = ' . json_encode($translations, JSON_UNESCAPED_UNICODE) . ';</script>';

// W JavaScript (ccpsgoogletrack.js):
function t(key, defaultText) {
if (typeof window.ccpsTranslations !== 'undefined'
&& window.ccpsTranslations[key]) {
return window.ccpsTranslations[key];
}
return defaultText || key;
}

// Użycie: debugLog(t('eventDisabled', 'Event wyłączony:') + ' ' + event);
Adding a new language:
  1. Copy the file translations/en.php
  2. Change the name to the language code, e.g. translations/en.php (German)
  3. Open the file in a text editor.
  4. Translate all values on the right side (after the = sign)
  5. DO NOT change the keys (on the left side)
  6. Save the file with UTF-8 encoding
  7. Clear the PrestaShop cache
Example translation file:
<?php global $_MODULE; $_MODULE = array(); $_MODULE['ccpsgoogletrack_eventdisabled'] = 'Event disabled:'; $_MODULE['ccpsgoogletrack_event'] = 'Event:'; $_MODULE['ccpsgoogletrack_sendingevent'] = 'Sending'; // ... more translations
List of all translation keys:
  • eventDisabled – „Event disabled:”
  • event – „Event:”
  • sendingEvent – „Sending”
  • receivedData – „Product data received from PHP for”
  • gettingProductData – „Retrieving product data via AJAX for”
  • ajaxError – „AJAX error”
  • parsingError – „JSON parsing error:”
  • dataError – „Product data retrieval error”
  • handlerRegistered – „Handler registered”
  • initialization – „CcpsGoogleTrack v2.0 – initialization”
  • initComplete – „CcpsGoogleTrack v2.0 – initialization complete”
  • prestashopEvent – „PrestaShop event”
Tip
If the store is multilingual, the translation system will automatically select the appropriate language based on the current PrestaShop language. All debug messages, event names in the configuration, and system messages will be displayed in the user's language.

12. Events – details
A detailed description of the implementation of each of the 18 events supported by the module.

page_view – Page view
  • When: On every page of the store
  • Hook: displayHeader
  • Data: page_type, page_url, page_title, language, currency, customer_status
  • Comments: The first event sent on each page contains complete contextual data.
view_item – Product display
  • When: On the product page
  • Hook: displayProductAdditionalInfo
  • Data: currency, value, items[] (item_id, item_name, price, item_brand, item_category, quantity=1)
  • Source: $product = prestashop.page.product or AJAX
view_item_list – Display a list of products
  • When: Categories, home page, search results
  • Hook: displayFooter (for category)
  • Data: currency, item_list_id, item_list_name, items[] (all products with index)
  • Comments: Uses prestashop.page.page_name to identify the list type
select_item – Click on a product
  • When: Clicking on a product link from the list
  • Mechanism: JavaScript click listener on .product-miniature a
  • Data: currency, item_list_id, item_list_name, items[] (clicked product)
  • Source: data-product-gtm attribute or AJAX
add_to_cart – Add to cart
  • When: After adding the product to the cart
  • Mechanism: Intercepting the PrestaShop event 'updateCart’
  • Data: currency, value, items[] (added product with quantity)
  • Source: prestashop.page.product or AJAX GetProductData
  • Comments: Detects quantity from various sources (#quantity_wanted, event.reason.qty, event.resp.quantity)
remove_from_cart – Remove from cart
  • When: After removing the product from the cart
  • Mechanism: Click listener on .remove-from-cart
  • Data: currency, value, items[] (deleted product)
  • Source: Attributes data-id-product, data-price, data-name
view_cart – View shopping cart
  • When: On the shopping cart page
  • Hook: displayShoppingCart
  • Data: currency, value, items[] (all items in the cart)
  • Source: $cart->getProducts()
begin_checkout – Start order
  • When: First step in order fulfillment
  • Mechanism: JavaScript on the checkout page
  • Data: currency, value, items[], coupon (if applicable)
  • Source: window.prestashop.cart
add_shipping_info – Delivery selection
  • When: After selecting the delivery method
  • Hook: actionCarrierProcess
  • Data: currency, value, items[], shipping_tier (carrier name)
  • Mechanism: Also, JavaScript listener for changes to the .delivery-option input
add_payment_info – Payment selection
  • When: After selecting the payment method
  • Mechanism: JavaScript listener on .payment-option input
  • Data: currency, value, items[], payment_type (payment module name)
purchase – Purchase
  • When: Order confirmation page
  • Hook: displayOrderConfirmation
  • Data: currency, transaction_id, value, tax, shipping, coupon, items[]
  • Source: $order = new Order($id_order)
  • Comments: The most important event for conversion
search – Search
  • When: Using the search engine
  • Hook: actionSearch
  • Data: search_term (search phrase)
  • Fallback: JavaScript checks URL parameters (s=, search_query=)
login – Log in
  • When: After user login
  • Hook: actionAuthentication
  • Mechanism: JavaScript also detects changes to ccpsUserLogged in sessionStorage.
  • Data: method: ’email’
sign_up – Registration
  • When: After registering a new customer
  • Hook: actionCustomerAccountAdd
  • Mechanism: The ccps_just_registered cookie transferred to sessionStorage
  • Data: method: ’email’
add_to_wishlist – Wish list
  • When: Add product to wishlist
  • Mechanism: Intercepting fetch and XMLHttpRequest to blockwishlist
  • Data: currency, value, items[] (added product)
  • Source: AJAX GetProductData
  • Comments: Works with the blockwishlist module
share – Sharing
  • When: Clicking on the social share button
  • Mechanism: Click listener on .social-sharing a
  • Data: method (facebook/twitter/pinterest/linkedin/email), content_type, item_id, items[]
  • Source: prestashop.page.product or AJAX
select_promotion – Click on promotion
  • When: Automatically if the product has a discount
  • Hook: displayProductAdditionalInfo (together with view_item)
  • Data: currency, value, items[], promotion_id, promotion_name
  • Comments: Uses specific_prices for promotion data
Success
All events comply with the official Google Analytics 4 Enhanced Ecommerce specification. The items[] data structure contains all required and recommended fields (item_id, item_name, price, quantity, item_brand, item_category). The module automatically normalizes category names (first letter capitalized) and supports up to 5 levels of category hierarchy.

13. Event calendar
Below is a calendar showing when and on which pages individual events are posted.

Events on different types of websites:
PageAutomatic eventsInteractive events
Homepagepage_view, view_item_listselect_item
Categorypage_view, view_item_listselect_item
Searchpage_view, search, view_item_listselect_item
Productpage_view, view_item, select_promotion (if discount)add_to_cart, add_to_wishlist, share
Basketpage_view, view_cartremove_from_cart, begin_checkout
Checkoutpage_view, begin_checkoutadd_shipping_info, add_payment_info
Confirmationpage_view, purchase
Loginpage_view, login
Registrationpage_view, sign_up
Customer journey with events:
  1. Homepage → page_view, view_item_list
  2. Clicking on a product → select_item
  3. Product page → page_view, view_item, (select_promotion)
  4. Add to cart → add_to_cart
  5. Shopping cart page → page_view, view_cart
  6. Start of order → begin_checkout
  7. Delivery options → add_shipping_info
  8. Payment options → add_payment_info
  9. Confirmation → page_view, purchase
Info
Each automatic event is sent when the page is loaded (PHP hook), while interactive events are sent in response to user actions (JavaScript). The module intelligently detects duplicates and does not send the same event twice for the same action.

14. Tag Assistant Test
Google Tag Assistant is Google's official tool for testing and debugging Google Tag Manager implementations.

Testing with Tag Assistant:
  1. Install the extension Tag Assistant Legacy by Google to Chrome
  2. Or use the new tool Google Tag Assistant in Chrome DevTools
  3. Go to the store page
  4. Click the Tag Assistant icon in the toolbar.
  5. Click „Enable” to start recording.
  6. Refresh page
  7. Perform test actions (add to cart, proceed to checkout, etc.)
  8. Review the Tag Assistant report
What to check in Tag Assistant:
  • GTM Tag Found – a green marker indicates correct installation
  • DataLayer – check that it contains the correct event data
  • Fired Tags – list of tags that have been activated
  • Variables – variables sent to GTM
  • Errors – red markers indicate problems
Tag configuration in GTM (GA4 example):
  1. Sign in to Google Tag Manager
  2. Go to the „Tags” tab”
  3. Click „New.”
  4. Select tag type: „Google Analytics: GA4 event”
  5. Enter the Measurement ID (G-XXXXXXXXXX from GA4)
  6. Event name: {{Event}} (built-in variable)
  7. Trigger: „Custom Event” with event names (add_to_cart, purchase, etc.)
  8. Or a universal trigger for all events with dataLayer
  9. Save and publish container
GTM Preview Mode:
  1. In GTM, click „Preview” in the upper right corner.
  2. Enter the store URL
  3. Click „Connect.”
  4. A new window with the GTM debugger will open.
  5. Perform actions in the store
  6. The debugger shows all dataLayer events in real time.
  7. Check which tags have been triggered for each event
Link to Tag Assistant:
Tip
The official Google testing tool can be found at: tagassistant.google.com

There, we can test whether everything is working correctly, whether GTM is installed, and whether events are being sent to Google Analytics correctly.

15 Troubleshooting
GTM does not load on the website
  1. Check if GTM is enabled in the module settings.
  2. Verify the correctness of the GTM Container ID (format: GTM-XXXXXX)
  3. Clear the PrestaShop cache (Advanced settings → Performance → Clear cache)
  4. Check the source of the page to see if it contains gtm.js and noscript iframe.
  5. Disable other modules that may modify the header
  6. Check for JavaScript errors in the console.
Events are not sent
  1. Enable debug mode and check the browser console
  2. Check if events are enabled in the module configuration.
  3. Verify that the dataLayer is defined (console.log(window.dataLayer))
  4. Check for conflicts with other GTM modules.
  5. Ensure that the module's JavaScript has loaded (ccpsgoogletrack.js).
  6. Check if hookDisplayHeader is executed by the theme
add_to_cart does not work
  1. Enable debug mode and observe the logs in the console.
  2. Check if the PrestaShop 'updateCart’ event is triggered.
  3. Verify that prestashop.on() is available
  4. Check if the products have assigned data (id_product, price, name)
  5. Ensure that the AJAX controller is functioning (/module/ccpsgoogletrack/ajax).
  6. Check for AJAX errors in the Network tab.
purchase does not register conversions
  1. Check if event purchase is enabled
  2. Verify that you are on the order-confirmation page.
  3. Ensure that hookDisplayOrderConfirmation is executed.
  4. Check that the order is loaded correctly ($order)
  5. Enable event logging and check if the purchase is being recorded.
  6. In GTM, check if you have configured the GA4 tag for the purchase event.
Translations are not working
  1. Check if the translations/XX.php file exists for your language.
  2. Verify the file format (UTF-8 encoding, correct PHP syntax)
  3. Clear the PrestaShop cache
  4. Check if window.ccpsTranslations is defined in the source of the page.
  5. Ensure that the t() function is available in JavaScript.
Event logging is not working
  1. Check if the feature is enabled in the settings
  2. Verify that the ps_ccpsgoogletrack_logs table exists in the database.
  3. Check database write permissions
  4. Ensure that the AJAX controller accepts requests (action=LogEvent).
  5. Enable WP_DEBUG and check the error logs.
  6. Check that you have not exceeded the table size limit.
Your own code does not execute
  1. Check if the feature is enabled in the settings
  2. Verify that the code is correct JavaScript (check the console)
  3. Ensure that you do not use tags in your code.
  4. Check if the code is in the source of the page (HEAD section).
  5. Test the code piece by piece to find the error.
Error
If the problems persist, enable debug mode in the module settings and event logging. Collect all information from the browser console, Network tab, and event logs. Contact COCOS support via cocos.codes/support attaching the collected information.

16 FAQS.
Is the module compatible with PrestaShop 9.0?
Yes, the module has been tested and is fully compatible with PrestaShop 1.7.x, 8.x, and the latest version 9.0.

Can I use the module without a Google Analytics account?
Yes, the module sends data to Google Tag Manager. GTM can transfer data to many different systems, not just Google Analytics. We can send data to Facebook Pixel, TikTok Pixel, our own analytics systems, etc.

Does the module slow down the store?
No, the module is optimized for performance. The GTM code loads asynchronously, and all scripts are minified. The impact on performance is minimal (< 0.1s load time).

Can I disable certain events?
Yes, in the module configuration, we can enable or disable each of the 18 events separately. Disabled events are not sent to the dataLayer at all.

How does add_to_cart detection work?
The module captures the PrestaShop 'updateCart’ event and listens for clicks on the add to cart buttons. It automatically detects quantities from various sources and fetches product data via AJAX if necessary.

Does the module support multilingualism?
Yes, the module has full translations for Polish and English. We can easily add our own languages by copying and translating files from the translations/ directory.

What are Enhanced Conversions?
Enhanced Conversions is a Google Ads feature that improves conversion measurement accuracy by sending hashed user data (email, phone number, address). It requires GDPR consent.

Is the module GDPR compliant?
The module itself is GDPR-compliant—it hashes all personal data using the SHA-256 algorithm. However, to be fully compliant, we must have an up-to-date privacy policy and user consent for cookies. We recommend integration with a cookie management module.

How can I check if the module is working correctly?
Enable debug mode in the settings, open the browser console (F12), and observe the logs. You can also use Google Tag Assistant or GTM preview mode to see all events in real time.

Can I add my own events?
Yes, you can use the „Custom Tracking Code” feature in the settings to add any JavaScript that will send your own events to dataLayer.

How long are event logs stored?
Logs are stored in the database until they are manually cleared. We recommend clearing logs regularly (e.g., monthly) to avoid filling up the database.

Does the module work with the cookies/GDPR module?
Yes, the module is compatible with most cookie consent management modules. We can integrate it with Google Consent Mode 2.0 through our own tracking code.

What happens during uninstallation?
The module removes all its settings from the database (options, log table). However, it does not remove the module files – these must be removed manually from the modules/ccpsgoogletrack/ directory.

Can I export event logs?
Currently, the module does not have a log export function. However, we can query the database directly (ps_ccpsgoogletrack_logs table) or add our own export function.

How often are translations updated?
Translations are updated with each new version of the module. If a translation for a particular language is missing, we can add it ourselves or report it to COCOS.

Leave Your comment

Your email address will not be published. Required fields are marked *

Recently viewed products

PrestaShop Google Tag Manager (GTM, GA4, ADS)

(0)
$49,00 VAT excluded

WordPress Customer Booking System 1.0.0

(3)
$49,00 VAT excluded

[FREE] PrestaShop PayNow

(0)
$0,00 VAT excluded

PrestaShop and WordPress development services

(2)
$27,00 VAT excluded

Login

Shopping Cart

Close

Your cart is empty.

Start Shopping

Sidebar